package cn.cdeden.knowledge.service;



import cn.cdeden.common.core.utils.page.TableDataInfo;
import cn.cdeden.knowledge.domain.TeamRole;
import cn.cdeden.knowledge.domain.dto.ProRoleToTeamRole;
import cn.cdeden.knowledge.domain.dto.TeamRoleDto;
import cn.cdeden.knowledge.domain.dto.TeamRoleQueryParam;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Set;

/**
* @author Chen
* @date 2022-11-22
*/
public interface TeamRoleService extends IService<TeamRole> {

    static final String CACHE_KEY = "teamPerm";

    /**
    * 查询数据分页
    * @param query 条件
    * @param pageable 分页参数
    * @return PageInfo<TeamPermDto>
    */
    TableDataInfo<TeamRoleDto> queryAll(TeamRoleQueryParam query, Pageable pageable);

    /**
    * 查询所有数据不分页
    * @param query 条件参数
    * @return List<TeamPermDto>
    */
    List<TeamRoleDto> queryAll(TeamRoleQueryParam query);

    TeamRole getById(Integer id);

    /**
     * 获取团队最高权限角色
     * @param teamId 团队id
     * @return
     */
    List<TeamRoleDto> getSupremeAuthority(String teamId);

    List<TeamRoleDto> getNextToOwner(String teamId);

    /**
     * 添加团队默认角色
     * @param teamId 团队id
     * @return 返回所有者id
     */
    Long addDefaultRole(String teamId);

    /**
     * 插入一条新数据。
     */
    TeamRole insert(TeamRoleDto resources);
    int updateById(TeamRoleDto resources);
    int removeById(Integer id);
    int removeByIds(Set<Integer> ids);

    void updateRole(TeamRoleDto teamRoleDto);

    List<TeamRoleDto> getRole(String teamId);

    TeamRole addOwnerRole(String teamId);

    TeamRole addRole(ProRoleToTeamRole proRoleToTeamRole, String teamId);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    // void download(List<TeamPermDto> all, HttpServletResponse response) throws IOException;
}
